package com.ibuonline.b2b.entity;

import java.io.Serializable;

import com.dimeng.common.util.StringUtil;

public class CompanyDetail implements Serializable {

	private static final long serialVersionUID = 2582032214148100232L;

	//fields
	private java.lang.Integer companyId;
	private java.lang.String profile;

	//default constructor
	public CompanyDetail() {
	}

	//getter
	public java.lang.Integer getCompanyId() {
		return companyId;
	}
	public java.lang.String getProfile() {
		return profile;
	}
	
	//setter
	public void setCompanyId(java.lang.Integer companyId) {
		this.companyId = companyId;
	}
	public void setProfile(java.lang.String profile) {
		this.profile = profile;
	}

	//equals method
	public boolean equals(Object other) {
		if (this == other)
			return true;
		if (!(other instanceof CompanyDetail))
			return false;

		final CompanyDetail companyDetail = (CompanyDetail)other;
		if (!this.companyId.equals(companyDetail.getCompanyId()))
			return false;

		return true;
	}

	//hashCode method
	public int hashCode() {
		StringBuffer keys = new StringBuffer();
		keys.append(companyId).append(",");
		if (keys.length() > 0)
			keys.deleteCharAt(keys.length() - 1);
		return keys.toString().hashCode();
	}

	//toString method
	public String toString() {
		return new StringBuilder("CompanyDetail[")
			.append("companyId=").append(companyId).append(", ")
			.append("profile=").append(profile).append("]").toString();
	}
	
	///###
	private String subProfile;
	public String getSubProfile() {
		subProfile = StringUtil.toHTML(this.profile);
		if (profile !=null && profile.length()>250) {
			subProfile =StringUtil.truncate(profile, 250);
		}  else {
			subProfile = profile;
		}
		return subProfile;
	}
	public void setSubProfile(String subProfile) {
		this.subProfile = subProfile;
	}
	public String getHtmlProfile(){
		if (this.profile != null) {
			profile = StringUtil.toHTML(this.profile);
		}
		return profile;
	}
}